package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.TBookReturnInfo;
import com.ruoyi.system.mapper.TBookReturnInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TBookBorrowInfoMapper;
import com.ruoyi.system.domain.TBookBorrowInfo;
import com.ruoyi.system.service.ITBookBorrowInfoService;
import com.ruoyi.common.core.text.Convert;

/**
 * 借书记录Service业务层处理
 * 
 * @author zhaowq
 * @date 2022-06-08
 */
@Service
public class TBookBorrowInfoServiceImpl implements ITBookBorrowInfoService 
{
    @Autowired
    private TBookBorrowInfoMapper tBookBorrowInfoMapper;

    @Autowired
    private TBookReturnInfoMapper tBookReturnInfoMapper;

    /**
     * 查询借书记录
     * 
     * @param id 借书记录主键
     * @return 借书记录
     */
    @Override
    public TBookBorrowInfo selectTBookBorrowInfoById(Long id)
    {
        return tBookBorrowInfoMapper.selectTBookBorrowInfoById(id);
    }

    /**
     * 查询借书记录列表
     * 
     * @param tBookBorrowInfo 借书记录
     * @return 借书记录
     */
    @Override
    public List<TBookBorrowInfo> selectTBookBorrowInfoList(TBookBorrowInfo tBookBorrowInfo)
    {
        return tBookBorrowInfoMapper.selectTBookBorrowInfoList(tBookBorrowInfo);
    }

    /**
     * 新增借书记录
     * 
     * @param tBookBorrowInfo 借书记录
     * @return 结果
     */
    @Override
    public int insertTBookBorrowInfo(TBookBorrowInfo tBookBorrowInfo)
    {
        tBookBorrowInfo.setCreateTime(DateUtils.getNowDate());
        return tBookBorrowInfoMapper.insertTBookBorrowInfo(tBookBorrowInfo);
    }

    /**
     * 修改借书记录
     * 
     * @param tBookBorrowInfo 借书记录
     * @return 结果
     */
    @Override
    public int updateTBookBorrowInfo(TBookBorrowInfo tBookBorrowInfo)
    {
        tBookBorrowInfo.setUpdateTime(DateUtils.getNowDate());
        tBookBorrowInfo.setStatus("1");
        return tBookBorrowInfoMapper.updateTBookBorrowInfo(tBookBorrowInfo);
    }

    /**
     * 批量删除借书记录
     * 
     * @param ids 需要删除的借书记录主键
     * @return 结果
     */
    @Override
    public int deleteTBookBorrowInfoByIds(String ids)
    {
        return tBookBorrowInfoMapper.deleteTBookBorrowInfoByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除借书记录信息
     * 
     * @param id 借书记录主键
     * @return 结果
     */
    @Override
    public int deleteTBookBorrowInfoById(Long id)
    {
        return tBookBorrowInfoMapper.deleteTBookBorrowInfoById(id);
    }
}
